package com.tyxy.edu.info.manager.service;

import com.tyxy.edu.info.manager.dao.StudentDao;
import com.tyxy.edu.info.manager.domain.Student;

public class StudentService {
    public boolean addstudent(Student student) {
        StudentDao studentDao=new StudentDao();
           return StudentDao.addstudent(student);

    }

    public boolean isExists(String id) {
        StudentDao studentDao = new StudentDao();
        Student[] stu = studentDao.findAllStudent();
        boolean exsits = false;
        for (int i = 0; i < stu.length; i++) {
            Student student = stu[i];

            if (student != null && student.getId().equals(id)) {
                exsits = true;
                break;
            }
            else {
                exsits = false;
            }

        }
    return exsits;
    }
}
